const Models = require("../../models");

module.exports = {
  name: "question",

  async create(data) {
    try {
      const res = await Models.models.question.core.create(data);
      return { ok: 1, data: res };
    } catch (e) {
      console.log(e);
      return { ok: 0 };
    }
  },

  async del(query) {
    try {
      await Models.models.question.core.destroy({ where: query });
      return { ok: 1 };
    } catch (e) {
      console.log(e);
      return { ok: 0 };
    }
  },

  async get_records(query) {
    try {
      const res = await Models.models.question.get_records(query);
      return { ok: 1, data: res };
    } catch (e) {
      console.log(e);
      return { ok: 0 };
    }
  },
};
